# -*- coding: utf-8 -*-
# ----------------------------
# @Time    : 2022/6/4 2:42 PM
# @Author  : changqingai
# @FileName: run_functions_eagerly.py
# ----------------------------
import tensorflow as tf


tf.config.run_functions_eagerly(run_eagerly=False)


def my_func(a):
    print("Python side effect")
    return a + a

a_fn = tf.function(my_func)

res = a_fn(tf.constant(2))
print("res:", res.numpy())
